define(['backbone', 'underscore', 'jsonview', 'jquery'], function(Backbone, _, jsonview, $) {

  function main() {
    require(['v/graph/mix/beijingMove'], app);
  }

  function app(beijingMove) {
    // var $app = $('<div id="app">')
    // $('#main').html($app);
    // 
    var optionStr = serialize(beijingMove);

    var option = unSerialize(optionStr);

    // console.log(optionStr)
    // console.log(option)
    console.log(timestamp2str(24 * 7270))
  }

  function timestamp2str(time) {
    var minTime = parseInt(time / 60)
    var hourTime = parseInt(time / 3600)
    var dateTime = parseInt(time / 86400)
    if (time <= 60) {
      return time + '秒';
    } else if (time >= 60 && time < 3600) {
      return minTime + '分钟' + parseInt(time - minTime * 60) + '秒';
    } else if (time >= 3600 && time < 86400) {
      return hourTime + '小时' + parseInt((time - hourTime * 3600) / 60) + '分钟' + parseInt(time - hourTime * 3600 - parseInt((time - hourTime * 3600) / 60) * 60) + '秒';
    } else if (time >= 86400) {
      return dateTime + '天' + parseInt((time - dateTime * 86400) / 3600) + '小时' + parseInt((time - dateTime * 86400 - parseInt((time - dateTime * 86400) / 3600) * 3600) / 60) + '分钟' + parseInt(time - dateTime * 86400 - parseInt((time - dateTime * 86400) / 3600) * 3600 - parseInt((time - dateTime * 86400 - parseInt((time - dateTime * 86400) / 3600) * 3600) / 60) * 60) + '秒';
    }
  }

  function function2string(k, v) {
    if (typeof v === 'function') {
      return v + '';
    }
    return v;
  }

  function string2function(k, v) {
    if (v.indexOf && v.indexOf('function') > -1) {
      return eval("(function(){return " + v + " })()");
    }
    return v;
  }

  function serialize(obj) {
    return JSON.stringify(obj, function2string);
  }

  function unSerialize(obj) {
    return JSON.parse(obj, string2function);
  }

  return main;
})
